package com.cloud.lan.api.manage;

import com.cloud.lan.api.dto.req.BaseReq;
import com.cloud.lan.api.dto.req.DelReq;
import com.cloud.lan.api.dto.req.LanGoodsLocationsReq;
import com.cloud.lan.entity.base.BaseResponse;
import com.cloud.lan.service.ILanGoodsLocationsService;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 商品购买信息 入口
 * @author ErKang
 * @date Created in 2021/12/5 04:24
 * @title TestApi.java
 * Department: Product development
 */
@RestController
@RequestMapping(value = {"/v1/manage/goods/locations/"}, method = {RequestMethod.GET, RequestMethod.POST}, produces = {"application/json"})
public class LanGoodsLocationsManageApi {

    @Resource
    ILanGoodsLocationsService lanGoodsLocationsService;

    @RequestMapping("manageList")
    public BaseResponse<Object> manageList(LanGoodsLocationsReq req) {
        return lanGoodsLocationsService.manageList(req);
    }

    @RequestMapping("add")
    public BaseResponse<Object> add(@RequestHeader(BaseReq.ut) String token, @RequestBody LanGoodsLocationsReq req) {
        req.setToken(token);
        return lanGoodsLocationsService.add(req);
    }

    @RequestMapping("update")
    public BaseResponse<Object> update(@RequestHeader(BaseReq.ut) String token, @RequestBody LanGoodsLocationsReq req) {
        req.setToken(token);
        return lanGoodsLocationsService.update(req);
    }

    @GetMapping("delete")
    public BaseResponse<Object> delete(@RequestHeader(BaseReq.ut) String token, DelReq req) {
        req.setToken(token);
        return lanGoodsLocationsService.delete(req);
    }
}
